Coqui (Eleutherodactylus coqui) Photo Credit: NPR

EDS 214 Coqui Crew

The Coqui Crew consists of Marie Rivers, Scout Leonard, Steven Cognac, and Julia Parish.

Our team name was inspired by the small but impressive coqui (Eleutherodactylus coqui), which is a native tree frog in Puerto Rico.

Questions

technical: How did hurricane Hugo impact stream chemistry at the Luquillo Experimental Forest?

team work flow: How can we collaborate to clean data, combine data, and produce a visualization?

Set Up

  • Steven made a Github repo with an R project containing our data
  • Marie, Julia, and Scout were assigned as collaborators on the repo
  • All of us worked on the project through our user accounts in the Taylor server
  • The data was stored in the Github repo and was uploaded in one person’s project.
  • Finally, we updated the way we call our data in from calling from our data folder in the project to calling from our shared storage group folder in the class folder on the Taylor Server.

Team Organization

  • First worked in assigned code chunks in the Rmd in one main branch.
  • After a few conflicts, we tried working in separate branches. We did:
    • Data cleaning on out own computers while verbalizing discussing our process
    • Practice visualizations of individual sites on our own computers/branches to plan for all-sites graph
      • We merged these branches to the main branch
    • We created a new branch from main for the next processes
      • Pair-coded with designated drivers and navigators for combining dataframes and creating visualization in branches
      • Navigators looked up visualization techniques and components and discussed dicisions with the rest of group

Coqui Crew Workflow Branches

Code below reads in and assigns multiple CSV files

# create a list of file names to read in

`QuebradaCuenca1-Bisley` <- read_csv("/courses/EDS214/coqui_crew/data/QuebradaCuenca1-Bisley.csv", na = c("-9999","-9999.0","-9999.00"))

`QuebradaCuenca2-Bisley` <- read_csv("/courses/EDS214/coqui_crew/data/QuebradaCuenca2-Bisley.csv", na = c("-9999","-9999.0","-9999.00"))

`QuebradaCuenca3-Bisley` <- read_csv("/courses/EDS214/coqui_crew/data/QuebradaCuenca3-Bisley.csv", na = c("-9999","-9999.0","-9999.00"))

`RioMameyesPuenteRoto` <- read_csv("/courses/EDS214/coqui_crew/data/RioMameyesPuenteRoto.csv", na = c("-9999","-9999.0","-9999.00"))

Cleaning BQ1 : Julia

bq1 <- `QuebradaCuenca1-Bisley` %>% 
  clean_names() %>% 
  mutate(sample_date = lubridate::mdy(sample_date)) %>% 
  mutate(year = year(sample_date)) %>% 
  mutate(month = month(sample_date)) %>% 
  select(-sample_time)

Cleaning BQ2: Scout

#created a new df called "bq2"
#separated the sample date column into sample dates and sample times for ease of wrangling the dates, which are of more importance 
#used lubridate to change `sample_date` data to mdy format
#added a year column using sample_date
#added a month column using sample_date

bq2 <- `QuebradaCuenca2-Bisley` %>% 
  clean_names() %>% 
  separate(col = sample_date, into = c("sample_date", "sample_time"), sep = " ") %>% 
  mutate(sample_date = lubridate::mdy(sample_date)) %>% 
  mutate(year = year(sample_date)) %>% 
  mutate(month = month(sample_date)) %>% 
  select(-sample_time)

Cleaning BQ3: Marie

# cleaning data for BQ3
bq3 <- `QuebradaCuenca3-Bisley` %>% 
  clean_names() %>% 
  mutate(sample_date = lubridate::mdy(sample_date)) %>% 
  mutate(year = year(sample_date)) %>% 
  mutate(month = month(sample_date)) %>% 
  select(-sample_time)

Cleaning PRM: Steven

prm <- RioMameyesPuenteRoto %>% 
  
  # clean name headings
  clean_names() %>% 
  
  # changed date "character" to "datetime"
  mutate(sample_date = lubridate::mdy(sample_date)) %>% 
  
  # separate out month and year
  mutate(year = year(sample_date)) %>% 
  mutate(month = month(sample_date)) %>% 
  select(-sample_time)

Combining Datasets: Marie

all_sites <- bind_rows(prm, bq1, bq2, bq3) %>% 
  group_by(sample_id)

Visualizing All Sites: Scout

all_sites_k <- ggplot(data = all_sites, aes(x = sample_date, y = k)) +
  geom_line(aes(color = sample_id, linetype = sample_id),
            size = 0.25,
            show.legend = FALSE) +
  scale_color_manual(values = c("blue4", "cyan2", "goldenrod1", "firebrick1")) +
  geom_vline(xintercept = as.numeric(as.Date("1989-09-21")), color = "blue", size = 1) +
  labs(title = "Impact of Hurricane Hugo on Stream Chemistry",
       subtitle = "Difference in Potassium and Nitrate at Stream Sites in the Luquillo Experimental Forest",
       x = NULL,
       y = expression(paste("k mg ", l^{-1}))) +
  scale_x_date(position = "top") +
  theme_minimal()

#all_sites_k 
#(used to view separate graphs before combining)

all_sites_no3 <- ggplot(data = all_sites, aes(x = sample_date, y = no3)) +
  geom_line(aes(color = sample_id, linetype = sample_id),
            size = 0.25,
            show.legend = TRUE) +
  scale_color_manual(values = c("blue4", "cyan2", "goldenrod1", "firebrick1")) +
  geom_vline(xintercept = as.numeric(as.Date("1989-09-21")), color = "blue", size = 1) +
  labs(x = NULL,
       y = expression(paste(NO[3]," ", "-N ", ug, l^{-1})),
       caption = "McDowell, W. 2021. Chemistry of stream water from the Luquillo Mountains ver 4923052. Environmental Data Initiative.") +
  theme_minimal() +
  theme(axis.text.x = element_blank())
  

#all_sites_no3 
#(used to view separate graphs before combining)
(all_sites_k / all_sites_no3) &
  theme(legend.position = c(0.9, 0.6),
        legend.background = element_blank(),
        legend.key.size = unit(0.1, 'cm'), 
        legend.title = element_blank())

Results / Challenges

We focused mostly on the team component over the analysis component in completing this project. Particularly, we learned a lot about branching in team work flows and regenerate our PATs.

As most of the class knows, there were significant technological limitations due to rapidly expiring PATs. Our first day on this project was consumed by navigating this hurdle and adapting to the disruption in our workflow of having to enter gitcreds::gitcreds_set() each time we attempted to push. Productivity was hampered as the whole group came to a standstill while we were waiting for our teammate to push and merge their edits.

While we had some conflicts as we worked in the same branch, they were small! We realized they were pretty easy to resolve and less scary retrospectively than the work of thinking about our branch structures.

In this process, we learned that creating separate markdown files may have been more efficient than multiple branches. For each branch merge to the main, we spent quite a bit of time thinking about the implications of merging. The conceptual logistics slowed down our analysis overall. It would have been complicated to work in the branches like this if we were not all in the same room.

Another lesson we learned is that it’s not advisable to experiment with code in the main branch. You always want to know that your main branch will run without error. A good use of branching is to experiment with new code in a single branch that can then be merged into the main branch without conflict when you’re happy with the code. We only worked in the main branch to do things like add this text!

Lessons Learned

  • Insert an image outside of code chunk
  • A better mental map of Taylor, GitHub, and personal computer & how they communicate with each other
  • Gradually incorporate & test new technologies before implementing them in a large-scale project or organization (aka beta testing)
  • How paired programming really plays out IRL
  • Switching off the Driver is important, helpful and essential
  • Storing data on a server has advantages vs on a personal computer but the technology has to be fully understood
  • Striking a balance between independent coding as a team versus sourcing information from other classmates

References

Coqui Crew GitHub Repository: https://github.com/cognack/coqui_crew

McDowell, W. 2021. Chemistry of stream water from the Luquillo Mountains ver 4923052. Environmental Data Initiative. https://doi.org/10.6073/pasta/ddb4d61aea2fb18b77540e9b0c424684 (Accessed 2021-08-26).

Acknowledgements MEDS

Thank you to our professor, Julien Bruin, for providing us with an opportunity to do a group project!

Jamie Montgomery and Casey O’hara for their technical assistance.

Sam Csik for assisting with color palettes and .HTML creation.

Brad Hill & Kat Le - our very own tech gurus. Thank you for providing support with Taylor, PATs, and installing important packages on our server.

and to our MEDS 2021 classmates - we appreciate your daily encouragement, advice, and laughs.

Coqui Capture Photo Credit: Tess Herman